package com.cherish.pattern.singleton.thread;

/**
 * @Classname ThreadLocalSingleton
 * @Date 2019/3/19 23:47
 * @Author admin
 * @Description TODO
 */
public class ThreadLocalSingleton {

    private ThreadLocalSingleton() {
    }

    private final static ThreadLocal<ThreadLocalSingleton> threadLocal = new ThreadLocal<ThreadLocalSingleton>(){
        @Override
        protected ThreadLocalSingleton initialValue() {
            return new ThreadLocalSingleton();
        }
    };

    public static ThreadLocalSingleton getInstance(){
        return threadLocal.get();
    }

}
